//
//  CorP5eFilter.m
//  CorP5e
//
//  Created by Matthew Giant on 9/27/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "CorP5eFilter.h"
#import "CorP5eSession.h"

extern CorP5eSession *gSession;

@implementation CorP5eFilter

@synthesize filter;

- (id)initWithFilterName:(NSString *)aFilterName
{
	if ( self = [super init] )
	{
		NSLog( @"Creating CorP5e filter %@.", aFilterName );
		
		filter = [[CIFilter filterWithName:aFilterName] retain];
		
		[filter setDefaults];
	}
	
	return self;
}

- (void)dealloc
{
	[filter release];
	[super dealloc];
}

/** set filter attribute keyName to image value **/
- (void)setFilterValueWithKey:(NSString *)keyName 
					withImage:(CIImage *)value
{
	[filter setValue:value 
			  forKey:keyName];
}

/** set filter attribute keyName to float value **/
- (void)setFilterValueWithKey:(NSString *)keyName
				    withFloat:(float)value;
{
	[filter setValue:[NSNumber numberWithFloat:value] 
			  forKey:keyName];
}

/** set filter attribute keyName to float value **/
- (void)setFilterValueWithKey:(NSString *)keyName
				    withVector:(CIVector *)value
{
	[filter setValue:value 
			  forKey:keyName];
}

- (id)getFilterValueForKey:(NSString *)keyName
{
	return [filter valueForKey:keyName];
}


- (void)setFilterValueWithKey:(NSString *)keyName
					withColor:(CIColor *)value
{
	[filter setValue:value forKey:keyName];
}

@end

